package com.yst.metho.web.application.vacationday;

import nextapp.echo2.app.Column;
import nextapp.echo2.app.Extent;
import nextapp.echo2.app.Grid;
import nextapp.echo2.app.Insets;
import nextapp.echo2.app.Label;
import nextapp.echo2.app.TextField;

import com.yst.suivi.data.vacationday.VacationDay;

public class VacationDayPane extends Column
{
	private TextField mJour;

	private TextField mMois;

	private TextField mAnnee;

	private String mId = null;

	public VacationDayPane(VacationDay vacation)
	{
		super();

		setCellSpacing(new Extent(10));
		setInsets(new Insets(10));
		Grid headerGrid = new Grid();
		headerGrid.setInsets(new Insets(0, 2));
		add(headerGrid);
		Label label;
		label = new Label("Jour");
		headerGrid.add(label);
		mJour = new TextField();
		mJour.setStyleName("TextField");
		headerGrid.add(mJour);
		label = new Label("Mois");
		headerGrid.add(label);
		mMois = new TextField();
		mMois.setStyleName("TextField");
		headerGrid.add(mMois);
		label = new Label("Annee");
		headerGrid.add(label);
		mAnnee = new TextField();
		mAnnee.setStyleName("TextField");
		headerGrid.add(mAnnee);
		if (null != vacation)
		{
			mId = vacation.getId();
			mJour.setText(vacation.getJour().toString());
			mAnnee.setText(vacation.getAnnee().toString());
			mMois.setText(vacation.getMois().toString());
		}
	}

	public VacationDayPane()
	{
		this(null);
	}

	/**
	 * @return the id
	 */
	public String getId()
	{
		return mId;
	}

	/**
	 * @return the annee
	 */
	public int getAnnee()
	{
		return Integer.parseInt(mAnnee.getText());
	}

	/**
	 * @return the jour
	 */
	public int getJour()
	{
		return Integer.parseInt(mJour.getText());
	}

	/**
	 * @return the mois
	 */
	public int getMois()
	{
		return Integer.parseInt(mMois.getText());
	}

}
